﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dark_Core_Library.UniModules.Models
{
    /// <summary>
    /// 操作聚合体
    /// </summary>
    public class UniOperationModeAggregation<TSender,TMode,TValue>
    where TSender :class
    where TMode :struct,Enum
    {
        /// <summary>
        /// 操作源
        /// </summary>
        public TSender Sender { set; get; }
        /// <summary>
        /// 操作模式
        /// </summary>
        public TMode Mode { set; get; }
        /// <summary>
        /// 操作值
        /// </summary>
        public TValue Value { set; get; }


        private UniOperationModeAggregation(TSender sender, TValue value, TMode mode)
        {
            this.Sender = sender;
            this.Value = value;
            this.Mode = mode;
        }


        /// <summary>
        /// 创建操作模式聚合体实例
        /// </summary>
        /// <typeparam name="TSender">操作源</typeparam>
        /// <typeparam name="TMode">操作模式</typeparam>
        /// <typeparam name="TValue">操作值</typeparam>
        /// <param name="sender">源</param>
        /// <param name="value">值</param>
        /// <param name="mode">模式</param>
        /// <returns></returns>
#pragma warning disable CS0693
        public static UniOperationModeAggregation<TSender, TMode, TValue> CreateInstance<TSender, TMode, TValue>(
#pragma warning restore CS0693
            TSender sender, TValue value, TMode mode)
        where TSender : class
        where TMode : struct,Enum
        {
            return new UniOperationModeAggregation<TSender, TMode, TValue>(sender, value, mode);
        }

    }
}
